//
//  UUSupplierReviewStatusTipsView.m
//  UUCharterSupplier
//
//  Created by ZhangAo on 24/02/2018.
//  Copyright © 2018 UUCharter. All rights reserved.
//

#import "UUSupplierReviewStatusTipsView.h"
#import <Masonry/Masonry.h>
#import "UUResourceManager.h"
#import "UUUserManager.h"

@interface UUSupplierReviewStatusTipsView ()

@end

@implementation UUSupplierReviewStatusTipsView

- (void)update {
    UUUserInfo *userInfo = GetUserManager().fetchUserInfo;
    
    if (userInfo.status == UUSupplierReviewStatusApproval) {
        [self hidesTipsView];
    } else {
        [self showSupplierReviewStatusTipsView];
    }
}

- (void)showSupplierReviewStatusTipsView {
    UUUserInfo *userInfo = GetUserManager().fetchUserInfo;
    
    NSString *remark;
    BOOL error = NO;
    if (userInfo.status == UUSupplierReviewStatusWaitingForReview) {
        remark = userInfo.remark.length == 0 ? @"你的注册信息已提交审核，请稍后" : userInfo.remark;
    } else {
        error = YES;
        remark = userInfo.remark.length == 0 ? @"你的注册信息审核失败！" : userInfo.remark;
    }
    
    [super showTipsViewWithText:[NSString stringWithFormat:@"%@ %@", GetResourceManager().warningIconText, remark] error:error];
}

@end
